<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\utils\XHtml;

/* @var $this yii\web\View */
/* @var $model app\models\Admin */

$this->title = $model->isNewRecord ? '新建用户' : '更新用户';
$this->params['breadcrumbs'][] = ['label' => '用户管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
    <div class="page-create">
        <div class="box box-primary">
            <div class="box-body">

                <?= $this->render('/site/error-summary', ['model' => $model]) ?>

                <?php $form = ActiveForm::begin([
                    'options' => ['class' => 'form-horizontal'],
                    'fieldConfig' => [
                        'template' => "{label}\n<div class=\"col-sm-5\">{input}</div>\n<div class=\"col-sm-5\">{hint}\n{error}</div>",
                        'labelOptions' => ['class ' => 'col-sm-2 control-label'],
                    ]
                ]); ?>
                <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
                <?= $form->field($model, 'password')->label("密码")->passwordInput(['maxlength' => 60]) ?>
                <?= $form->field($model, 'password2')->label("确认密码")->passwordInput(['maxlength' => 60]) ?>
                <?= $form->field($model, 'email') ?>
                <?= $form->field($model, 'group_id')->label("所属角色")->dropDownList($groupList) ?>
                <?= $form->field($model, 'status')->dropDownList(['10' => '开启', '0' => '禁用'])->label('状态') ?>

                <div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <?= XHtml::submitButton($model->isNewRecord ? '创建' : '更新') ?>&nbsp;&nbsp;
                    <?= XHtml::backButton() ?>&nbsp;&nbsp;
                    <?= XHtml::resetButton() ?>
                </div>
                <?php ActiveForm::end(); ?>
            </div>
        </div>
    </div>
<?php
$script = <<<JS
    
JS;
$this->registerJs($script);
?>